package summer.presum;

public class Solution1094 {
    public boolean carPooling(int[][] trips, int capacity) {
        int[] hash = new int[1001];
        for (int[] x : trips) {
            for (int i = x[1]; i <= x[2]; i++) {
                hash[i] += x[0];
                if (hash[i] > capacity) return false;
            }
        }
        return true;
    }
}
